﻿using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace mozhi.smarterp.BasicData.Migrations
{
    public partial class _202504022018 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_Location_MozhiWarehouse_WarehouseId",
                table: "Location");

            migrationBuilder.DropForeignKey(
                name: "FK_SupplierContactItem_MozhiSupplier_SupplierId",
                table: "SupplierContactItem");

            migrationBuilder.DropPrimaryKey(
                name: "PK_SupplierContactItem",
                table: "SupplierContactItem");

            migrationBuilder.DropPrimaryKey(
                name: "PK_Location",
                table: "Location");

            migrationBuilder.RenameTable(
                name: "SupplierContactItem",
                newName: "MozhiSupplierContactItem");

            migrationBuilder.RenameTable(
                name: "Location",
                newName: "MozhiLocation");

            migrationBuilder.RenameIndex(
                name: "IX_SupplierContactItem_SupplierId",
                table: "MozhiSupplierContactItem",
                newName: "IX_MozhiSupplierContactItem_SupplierId");

            migrationBuilder.RenameIndex(
                name: "IX_Location_WarehouseId",
                table: "MozhiLocation",
                newName: "IX_MozhiLocation_WarehouseId");

            migrationBuilder.AddPrimaryKey(
                name: "PK_MozhiSupplierContactItem",
                table: "MozhiSupplierContactItem",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_MozhiLocation",
                table: "MozhiLocation",
                column: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_MozhiLocation_MozhiWarehouse_WarehouseId",
                table: "MozhiLocation",
                column: "WarehouseId",
                principalTable: "MozhiWarehouse",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_MozhiSupplierContactItem_MozhiSupplier_SupplierId",
                table: "MozhiSupplierContactItem",
                column: "SupplierId",
                principalTable: "MozhiSupplier",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_MozhiLocation_MozhiWarehouse_WarehouseId",
                table: "MozhiLocation");

            migrationBuilder.DropForeignKey(
                name: "FK_MozhiSupplierContactItem_MozhiSupplier_SupplierId",
                table: "MozhiSupplierContactItem");

            migrationBuilder.DropPrimaryKey(
                name: "PK_MozhiSupplierContactItem",
                table: "MozhiSupplierContactItem");

            migrationBuilder.DropPrimaryKey(
                name: "PK_MozhiLocation",
                table: "MozhiLocation");

            migrationBuilder.RenameTable(
                name: "MozhiSupplierContactItem",
                newName: "SupplierContactItem");

            migrationBuilder.RenameTable(
                name: "MozhiLocation",
                newName: "Location");

            migrationBuilder.RenameIndex(
                name: "IX_MozhiSupplierContactItem_SupplierId",
                table: "SupplierContactItem",
                newName: "IX_SupplierContactItem_SupplierId");

            migrationBuilder.RenameIndex(
                name: "IX_MozhiLocation_WarehouseId",
                table: "Location",
                newName: "IX_Location_WarehouseId");

            migrationBuilder.AddPrimaryKey(
                name: "PK_SupplierContactItem",
                table: "SupplierContactItem",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_Location",
                table: "Location",
                column: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_Location_MozhiWarehouse_WarehouseId",
                table: "Location",
                column: "WarehouseId",
                principalTable: "MozhiWarehouse",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_SupplierContactItem_MozhiSupplier_SupplierId",
                table: "SupplierContactItem",
                column: "SupplierId",
                principalTable: "MozhiSupplier",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }
    }
}
